package com.billjc.hrm.action;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;

import com.billjc.hrm.base.IbatisSessionFactory;
import com.billjc.hrm.model.Employee;
import com.opensymphony.xwork2.ActionSupport;
import static com.opensymphony.xwork2.Action.*;

@ParentPackage("json-default")
@Results( { @Result(name = SUCCESS, type = "json") })
public class EmployeeManagerAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 4425227428043569853L;
	private SqlSessionFactory sessionfactory = IbatisSessionFactory
			.getSqlSessionFactory();
	private List<Employee> listEmp = null;

	public String input() {

		return INPUT;
	}

	public String list() {
		SqlSession session = sessionfactory.openSession();
		listEmp = session.selectList("employee.employeeInfoAll");
		return SUCCESS;
	}

	public List<Employee> getListEmp() {
		return listEmp;
	}

	public void setListEmp(List<Employee> listEmp) {
		this.listEmp = listEmp;
	}

}
